{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "from bs4 import BeautifulSoup\n",
    "import re\n",
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'f1': 2, 'f2': 363236, 'f3': -116, 'f4': -4266, 'f12': '000001', 'f13': 1, 'f14': '上证指数'}\n"
     ]
    }
   ],
   "source": [
    "headers = {\n",
    "    'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 QIHU 360SE'\n",
    "}\n",
    "\n",
    "res = requests.get(\"https://push2.eastmoney.com/api/qt/ulist/get?fields=f12,f13,f14,f1,f2,f4,f3&secids=1.000001,0.399001&pn=1&np=1\", headers=headers)\n",
    "# print(res.text)\n",
    "js = json.loads(res.text)\n",
    "print(js['data']['diff'][0])"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "0d008810b9c8467bcb3ca39aa2180e5b81b3a9acb136aab30d47954377cc5120"
  },
  "kernelspec": {
   "display_name": "Python 3.9.2 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
